//
//  EmptyTipView.m
//  mcrmSAAS
//
//  Created by wjxfhxy on 14-8-22.
//  Copyright (c) 2014年 GuangZhouXuanWu. All rights reserved.
//

#import "EmptyTipView.h"

@implementation EmptyTipView
{
    UIImageView *_imageView;
    UILabel *_textLabel;
}

- (id)initWithFrame:(CGRect)frame tipType:(EmptyTipType)tipType
{
    self = [super initWithFrame:frame];
    if (self)
    {
   //     _imageView = [UIImageView alloc]init
        NSString *tip = @"";
        UIImage *image = nil;
        switch(tipType)
        {
            case EmptyTipTypeCustomer:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_customer"];
                tip = @"暂无客户，请点击右上角菜单添加吧";
                break;
            }
            case EmptyTipTypeOppor:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_oppor"];
                tip = @"暂无商机，请点击右上角菜单添加吧";
                break;
            }
            case EmptyTipTypeContact:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"暂无联系人，请点击右上角菜单添加吧";
                break;
            }
            case EmptyTipTypeSubordinateCustomer:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"没找到您下属的客户";
                break;
            }
            case EmptyTipTypeSubordinateOppor:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"没找到您下属的商机";
                break;
            }
            case EmptyTipTypeNotiInfo:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"暂无数据";
                break;
            }
            case EmptyTipTypeRecentChat:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"暂无最近会话";
                break;
            }
            case EmptyTipTypeAllCustomer:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"没找到您的客户";
                break;
            }
            case EmptyTipTypeApplication:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"暂无应用";
                break;
            }
            case EmptyTipTypeSearch:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"亲，没有相关数据";
                break;
            }
            case EmptyTipTypeAdandonOppor:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"没找到公共商机";
                break;
            }
            case EmptyTipTypeMessage:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"亲，没有相关数据";
                break;
            }
            case EmptyTipTypeVisitPlan:
            {
                image = [UIImage imageWithMainBundle:@"img_emptytip_message"];
                tip = @"暂无计划";
                break;
            }

        }
        _imageView = [[UIImageView alloc]initWithImage:image];
        [self addSubview:_imageView];
        
        CGSize size = [tip stringSizeWithFont:[UIFont systemFontOfSize:14]];
        _textLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, size.width, size.height)];
        _textLabel.backgroundColor = [UIColor clearColor];
        _textLabel.text = tip;
        _textLabel.textColor = [UIColor grayColor];
        _textLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:_textLabel];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    _imageView.centerX = self.width / 2;
    _imageView.centerY = self.height / 7 *2.5;
    
    _textLabel.centerX = self.width / 2;
    _textLabel.centerY = self.height / 7 *4;
}

@end
